package com.wiscamp.ninechapters.accounts.infrastructure.mappers;

import com.wiscamp.ninechapters.accounts.infrastructure.po.AccountLogPO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Component;

import java.util.Collection;

@Component
public interface AccountLogMapper extends JpaRepository<AccountLogPO, Long>, JpaSpecificationExecutor<AccountLogPO> {

    @Query(value = "select e from AccountLogPO e where e.accountType = :accountType and e.userId = :userId order by e.logId")
    Collection<AccountLogPO> getAccountLogs(int accountType, long userId);
}